//
//  UIView+CornerRadius.swift
//  OCSSStoreSwift
//
//  Created by MacMiniKangChe on 2018/10/12.
//  Copyright © 2018年 MacMiniKangChe. All rights reserved.
//

import Foundation
import UIKit
extension UIView{
    func anyDirectCorner(radius:CGFloat) -> Void {
        let maskPath = UIBezierPath.init(roundedRect: self.bounds, byRoundingCorners: UIRectCorner(rawValue: UIRectCorner.RawValue(UInt8(UIRectCorner.topLeft.rawValue)|UInt8(UIRectCorner.topRight.rawValue))), cornerRadii: CGSize.init(width: radius, height: radius));
        let maskLayer = CAShapeLayer.init();
        maskLayer.frame = self.bounds;
        maskLayer.path = maskPath.cgPath;
        self.layer.mask = maskLayer;
    }
}
